<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/jedate.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/uploader/webuploader.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/fonts/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="../../../../resources/layui/css/layui.css"/>
		<style>
			.saixuan:after{width: 0;}
			.layui-form-pane .layui-input-block{margin-left: 0;}

			@media screen and (max-width: 1280px) {
				.layui-form-pane .layui-form-label{width: 108px;}

			}

			.layui-form-item .layui-input-inline{width: 165px;}
			.masksx .forms{padding-left: 0;text-align: center;}
			.masksx{width: 650px;}
			.mask input{width: 100%!important;}
			.mask .layui-select-title{width: 480px;}
			.layui-inline{margin-bottom: 10px;}
			.layui-upload{ text-align: left;}
			#demo2 img{width: 90px; height: 90px;}
			.imgs{position: relative;width: 90px; height: 90px; float: left; margin-right: 10px; margin-bottom: 10px;}
			._ingshan{position: absolute;right: -5px;top: -5px; background-color:#ff0000;border: 1px solid #FF0000;
				border-radius: 50%;width: 22px;height: 22px;text-align: center;}
			@media only screen and (min-width: 321px) and (max-width: 1024px) {
				.layui-form-pane .layui-input-inline {width: 100%;}
				._inkong{ width:auto!important; }
				.layui-form-item .layui-input-inline{width: 100%;}
				.masksx{height: 50%;}
			}
			
			@media screen and (max-width: 750px){
				.MOVE_queryon .layui-form-item {
					width: 80%;
				}
				.layui-form-item{padding: 0;}
				.MOVE_footer{text-align: right;}
				.MOVE_footer a{color: #FFF;font-size: 20px;line-height: 30px;
					padding: 10px;background-color: #F5A721;height: 100%;position: absolute;right: 0;}
				.tijiao{z-index: 9999;}
			}
			._ingshan .layui-icon{ color: #fff; margin-top: -2px;}
			.danhao{display: none; padding-left: 32px;}
			.danhao .layui-form-label,.danhao ._inkong{float: left;}
			.danhao ._inkong{margin-bottom: 10px; }
			.masksx ._inkong{}
			.layui-table-cell{text-align: left;}
			.layui-form-select{width: 80%!important;}
			.layui-btn{ display: block; padding: 0; text-align:center;width:90px; height: 90px; border-radius: 5px; background-color: #f5f5f5;}
			.layui-btn .layui-icon{ text-align: center; color: #999; font-size: 66px; margin: 0 auto;}
			.layui-quote-nm{ padding: 0; border:none;}
		</style>
	</head>
	<body>
		<div class="container-fluid">
			<div class="row mheader">
				<div class="col-xs-2 text-left"> <a href="javascript:;" onclick="javascript:history.back(-1);"><span class="iconfont icon-fanhui"></span></a> </div>
				<div class="col-xs-8"><h2>申请签证</h2></div>
				<div class="col-xs-2 text-right"><a href="###" onclick="tijiao()">确定</span></a></div>
			</div>
			<div class="row">
				<div class="com-form ">
					<form class="form-horizontal">
						<div class="form-group">
					    	<label class="col-xs-3 control-label">工程名称:</label>
					    	<div class="col-xs-9">
								<div class="select-box">
						    		<span class="caret"></span>
									<select class="form-control xialas">

									</select>
								</div>
							</div>
						</div>
						<div class="form-group">
					    	<label class="col-xs-3 control-label" >签证人:</label>
					    	<div class="col-xs-9">
					    		<input type="text" class="form-control" id="qianzhengren" placeholder="" value="张三">
					    	</div>	
					  	</div>
					  	<div class="form-group">
					    	<label class="col-xs-3 control-label">签证内容:</label>
					    	<div class="col-xs-9">
					    		<textarea class="form-control" rows="3" id="qianneirong">请求签证通过</textarea>
					    	</div>
					  	</div>
						<div class="form-group">
							<label class="col-xs-3 control-label">现场图:</label>
							<div class="layui-input-inline col-xs-9">
								<div class="layui-upload">
									<button type="button" class="layui-btn" id="test2"><i class="layui-icon">&#xe654;</i> </button>
									<blockquote class="layui-elem-quote layui-quote-nm">
										<div class="layui-upload-list clearfix" id="demo2"></div>
									</blockquote>
									</div>
								</div>
						</div>
					</form>
				</div>
			</div>
			
		</div>
	</body>
</html>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../../../resource/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../resource/uploader/webuploader.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../resources/layui/layui.all.js" type="text/javascript" charset="utf-8"></script>

<script src="../../../resource/js/style.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

	function tijiao() {
		var cc_uuid=$('.form-control').val();
		var s_person=$('#qianzhengren').val();
		var s_content=$('#qianneirong').val();
        s_content=$.trim(s_content);
		var s_img=_picurls.toString();;
		ajaxs('api/buil/builSignHisBao.do','post',{'cc_uuid':cc_uuid,'s_person':s_person,'s_content':s_content,'s_img':s_img,'p':getP(),'buil_code':'001'},function (data) {
			console.log(data)
            window.tool.alert(data.msg);

            if(data.code==0){
			    location.href='./visa-list.html';
			}


        })


    }
    var _picurls=new Array();


    layui.use(['form', 'layedit', 'laydate','table','element','upload','flow'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , table = layui.table
            , element = layui.element
            , flow = layui.flow
            , upload = layui.upload;

        var img_arr=new Array();
        ajaxs('/api/public/loadPriDropDown.do','post',{'type':'d','p':getP()},function (data) {
            var d=data.data;

            for (var i = 0; i < d.length; i++) {
                $('.xialas').append('<option value="' + d[i].cc_UUID + '">' + d[i].proName + '</option>\n')
            }
        })



        $(document).on('click','._ingshan',function () {
            console.log($(this).prev().attr('src'))
            var shanSRC=$(this).prev().attr('src');
            $(this).parent().remove();
            $.each(_picurls,function(index,item){       //删除功能
                // index是索引值（即下标）   item是每次遍历得到的值；
                if(item==shanSRC){
                    _picurls.splice(index,1);
                }
            });
            console.log(_picurls)
        })

        //图片上传
        upload.render({
            elem: '#test2'
            ,url: urls+'api/public/uploadImg.do'
            ,multiple: true
			,size:1024*10
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
            }
            ,done: function(res){
                //上传完毕
                console.log(res)
                window.tool.alert(res.msg);
                _picurls.push(res.data[0]);         //返回的数据  放进数组中以便传递
                $('#demo2').append('<div class="imgs"><img src="'+urls+ res.data[0] +'" class="layui-upload-img"> <span class="_ingshan"><i class="layui-icon">&#x1006;</i> </span></div>')

            }
            ,error: function(index, upload){
                //当上传失败时，你可以生成一个“重新上传”的按钮，点击该按钮时，执行 upload() 方法即可实现重新上传
                console.log(index,upload)
            }
        });




    });



</script>








